package nullby.omnia.activity.voc;

import nullby.omnia.ApplicationOmnia;
import nullby.omnia.R;
import nullby.omnia.adapter.AdapterVocabulares;
import nullby.omnia.db.DatabaseHelper;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.ListView;

public class ActivityVocabulareList extends Activity implements OnClickListener {
	private Button bAddVoc;
	private ListView lvVocabulares;
	private AdapterVocabulares adapter;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_list_voc);

		initView();

		adapter = new AdapterVocabulares(getApplicationContext(),
				DatabaseHelper.get().getAllVocabulares(
						ApplicationOmnia.translationId));

		lvVocabulares.setAdapter(adapter);
	}

	protected void initView() {
		lvVocabulares = (ListView) findViewById(R.id.lvVocabulares);
		bAddVoc = (Button) findViewById(R.id.bAddVoc);
		bAddVoc.setOnClickListener(this);
	}

	@Override
	public void onClick(View v) {
		Integer id = v.getId();
		switch (id) {
		case R.id.bAddVoc:
			Intent intent = new Intent(ActivityVocabulareList.this,
					ActivityVocabulareAddNew.class);
			startActivity(intent);
			break;

		default:
			break;
		}
	}
}